package com.dg.cuckoo.admin.action.compilation;

import com.dg.cuckoo.admin.dto.compilation.GovernmentMoneyDto;
import com.dg.cuckoo.admin.service.GovernProcurementService;
import com.dg.cuckoo.common.utils.PageModel;
import com.dg.cuckoo.core.BaseController;
import com.dg.cuckoo.core.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 制度汇编-政府采购
 */
@RestController
@RequestMapping("/compilation/governProcurement")
public class GovernProcurement extends BaseController {

    @Autowired
    private GovernProcurementService service;

    /**
     * 新建
     */
    @PostMapping("save")
    public JsonResult<Void> save(GovernmentMoneyDto dto, MultipartFile[] files) throws Exception {
        service.save(dto,files);
        return new JsonResult<>(OK);
    }


    /**
     * 修改
     */
    @PostMapping("updata/{id}")
    public JsonResult<Void> update(@PathVariable String id,GovernmentMoneyDto dto, MultipartFile[] files) throws Exception {
        service.update(id,dto,files);
        return new JsonResult<>(OK);
    }

    /**
     * 分页
     */
    /**
     * 分页
     */
    @PostMapping("page/{page}/{pageSize}")
    public JsonResult<PageModel> page(@PathVariable Integer page, @PathVariable Integer pageSize){
        PageModel data = service.page(page, pageSize);
        return new JsonResult<>(OK,data);
    }

}
